package cn.zsc.netdisk.handler;

import cn.zsc.netdisk.util.EncodeUtil;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * @author ccying
 * @date 2021/2/4
 */
@Component
public class PasswordEncoderHandler implements PasswordEncoder {
    @Override
    public String encode(CharSequence charSequence) {
        return EncodeUtil.encode(charSequence.toString());
    }

    @Override
    public boolean matches(CharSequence charSequence, String s) {
        return s.equals(EncodeUtil.encode(charSequence.toString()));
    }
}
